<!DOCTYPE html>
<html>
<head>
	<title>Adding</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<script src="../common/testdata.js"></script>
	<script>
		var myBarChart;
		function doOnLoad() {
			myBarChart =  new dhtmlXChart({
				view:"bar",
				container:"chartDiv",
				value:"#sales#",
				label:"#sales#",
				gradient:"rising",
				width:50,
				radius:2,
				tooltip:{
					template:"#sales#"
				},
				yAxis:{
					start:0,
					end:100,
					step:10,
					template:function(value){
						return value%20?"":value
					}
				},
				xAxis:{
					template:"'#year#"
				}
			});
			myBarChart.parse(dataset,"json");
		};
		var counter = 12;
		function addNew () {
			myBarChart.add({
				year:counter,
				sales:parseInt(Math.random()*100,10)
			});
			counter++;
		}
		function deleteFirst(){
			myBarChart.remove(myBarChart.first());
		}
	</script>
</head>
<body onload="doOnLoad();">
	<div id="chartDiv" style="width:800px;height:250px;border:1px solid #c0c0c0;"></div>
	<input type="button" value="add" onclick="addNew()">
	<input type="button" value="delete" onclick="deleteFirst()">
</body>
</html>
